/*
 * Copyright (c) 2021-2022 Huawei Device Co.,  Ltd.
 * Licensed under the Apache License,  Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,  software
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,  either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "recptprinter_client_test.h"

#include <iostream>
#include <string>
#include <gtest/gtest.h>
#include "recptprinter_hilog.h"
#include "recptprinter_srv_client.h"

using namespace OHOS;

namespace SwanLink {
namespace Finance {

void RecptprinterClientTest::SetUpTestCase(void)
{
	
}

void RecptprinterClientTest::TearDownTestCase(void)
{
}

void RecptprinterClientTest::SetUp(void)
{
}

void RecptprinterClientTest::TearDown(void)
{
}

/**
 * @tc.name: RecptprinterClient001
 * @tc.desc: Test Recptprinter interface GetPrintFormat
 * @tc.type: FUNC
 */
HWTEST_F (RecptprinterClientTest, RecptprinterClient001, TestSize.Level1)
{
    RECPTPRINTER_HILOGD(RECPTPRINTER_TEST, "RecptprinterClient::RecptprinterClient001 start.");
    auto& client = RecptprinterSrvClient::GetInstance();
    if (g_isMock) {
        int handle = -1;
        PrintFormatType ftt = {};
;
        auto ret = client.GetPrintFormat(handle, ftt);
        RECPTPRINTER_HILOGI(RECPTPRINTER_TEST, "RecptprinterClientTest::ret=%{public}d", ret);
        GTEST_LOG_(INFO) << "RecptprinterClient::RecptprinterClient001 executing,  ret = " << ret;
        ASSERT_TRUE(ret == 0);
    } else {
        int handle = -1;
        PrintFormatType ftt = {};
;
        auto ret = client.GetPrintFormat(handle, ftt);
        RECPTPRINTER_HILOGI(RECPTPRINTER_TEST, "RecptprinterClientTest::ret=%{public}d", ret);
        GTEST_LOG_(INFO) << "RecptprinterClient::RecptprinterClient001 executing,  ret = " << ret;
        ASSERT_TRUE(ret == 0);
    }
    RECPTPRINTER_HILOGD(RECPTPRINTER_TEST, "RecptprinterClient::RecptprinterClient001 end.");
}
/**
 * @tc.name: RecptprinterClient002
 * @tc.desc: Test Recptprinter interface SetPrintFormat
 * @tc.type: FUNC
 */
HWTEST_F (RecptprinterClientTest, RecptprinterClient002, TestSize.Level1)
{
    RECPTPRINTER_HILOGD(RECPTPRINTER_TEST, "RecptprinterClient::RecptprinterClient002 start.");
    auto& client = RecptprinterSrvClient::GetInstance();
    if (g_isMock) {
        int handle = -1;
        PrintFormatType ftt = {};
        int value = -1;
;
        auto ret = client.SetPrintFormat(handle, ftt, value);
        RECPTPRINTER_HILOGI(RECPTPRINTER_TEST, "RecptprinterClientTest::ret=%{public}d", ret);
        GTEST_LOG_(INFO) << "RecptprinterClient::RecptprinterClient002 executing,  ret = " << ret;
        ASSERT_TRUE(ret == 0);
    } else {
        int handle = -1;
        PrintFormatType ftt = {};
        int value = -1;
;
        auto ret = client.SetPrintFormat(handle, ftt, value);
        RECPTPRINTER_HILOGI(RECPTPRINTER_TEST, "RecptprinterClientTest::ret=%{public}d", ret);
        GTEST_LOG_(INFO) << "RecptprinterClient::RecptprinterClient002 executing,  ret = " << ret;
        ASSERT_TRUE(ret == 0);
    }
    RECPTPRINTER_HILOGD(RECPTPRINTER_TEST, "RecptprinterClient::RecptprinterClient002 end.");
}
/**
 * @tc.name: RecptprinterClient003
 * @tc.desc: Test Recptprinter interface GetDeviceSpec
 * @tc.type: FUNC
 */
HWTEST_F (RecptprinterClientTest, RecptprinterClient003, TestSize.Level1)
{
    RECPTPRINTER_HILOGD(RECPTPRINTER_TEST, "RecptprinterClient::RecptprinterClient003 start.");
    auto& client = RecptprinterSrvClient::GetInstance();
    if (g_isMock) {
        int handle = -1;
        DeviceSpec spec = {};
;
        auto ret = client.GetDeviceSpec(handle, spec);
        RECPTPRINTER_HILOGI(RECPTPRINTER_TEST, "RecptprinterClientTest::ret=%{public}d", ret);
        GTEST_LOG_(INFO) << "RecptprinterClient::RecptprinterClient003 executing,  ret = " << ret;
        ASSERT_TRUE(ret == 0);
    } else {
        int handle = -1;
        DeviceSpec spec = {};
;
        auto ret = client.GetDeviceSpec(handle, spec);
        RECPTPRINTER_HILOGI(RECPTPRINTER_TEST, "RecptprinterClientTest::ret=%{public}d", ret);
        GTEST_LOG_(INFO) << "RecptprinterClient::RecptprinterClient003 executing,  ret = " << ret;
        ASSERT_TRUE(ret == 0);
    }
    RECPTPRINTER_HILOGD(RECPTPRINTER_TEST, "RecptprinterClient::RecptprinterClient003 end.");
}
/**
 * @tc.name: RecptprinterClient004
 * @tc.desc: Test Recptprinter interface FeedPaper
 * @tc.type: FUNC
 */
HWTEST_F (RecptprinterClientTest, RecptprinterClient004, TestSize.Level1)
{
    RECPTPRINTER_HILOGD(RECPTPRINTER_TEST, "RecptprinterClient::RecptprinterClient004 start.");
    auto& client = RecptprinterSrvClient::GetInstance();
    if (g_isMock) {
        int handle = -1;
        int line = -1;
;
        auto ret = client.FeedPaper(handle, line);
        RECPTPRINTER_HILOGI(RECPTPRINTER_TEST, "RecptprinterClientTest::ret=%{public}d", ret);
        GTEST_LOG_(INFO) << "RecptprinterClient::RecptprinterClient004 executing,  ret = " << ret;
        ASSERT_TRUE(ret == 0);
    } else {
        int handle = -1;
        int line = -1;
;
        auto ret = client.FeedPaper(handle, line);
        RECPTPRINTER_HILOGI(RECPTPRINTER_TEST, "RecptprinterClientTest::ret=%{public}d", ret);
        GTEST_LOG_(INFO) << "RecptprinterClient::RecptprinterClient004 executing,  ret = " << ret;
        ASSERT_TRUE(ret == 0);
    }
    RECPTPRINTER_HILOGD(RECPTPRINTER_TEST, "RecptprinterClient::RecptprinterClient004 end.");
}
/**
 * @tc.name: RecptprinterClient005
 * @tc.desc: Test Recptprinter interface CutPaper
 * @tc.type: FUNC
 */
HWTEST_F (RecptprinterClientTest, RecptprinterClient005, TestSize.Level1)
{
    RECPTPRINTER_HILOGD(RECPTPRINTER_TEST, "RecptprinterClient::RecptprinterClient005 start.");
    auto& client = RecptprinterSrvClient::GetInstance();
    if (g_isMock) {
        int handle = -1;
        int line = -1;
        int mode = -1;
;
        auto ret = client.CutPaper(handle, line, mode);
        RECPTPRINTER_HILOGI(RECPTPRINTER_TEST, "RecptprinterClientTest::ret=%{public}d", ret);
        GTEST_LOG_(INFO) << "RecptprinterClient::RecptprinterClient005 executing,  ret = " << ret;
        ASSERT_TRUE(ret == 0);
    } else {
        int handle = -1;
        int line = -1;
        int mode = -1;
;
        auto ret = client.CutPaper(handle, line, mode);
        RECPTPRINTER_HILOGI(RECPTPRINTER_TEST, "RecptprinterClientTest::ret=%{public}d", ret);
        GTEST_LOG_(INFO) << "RecptprinterClient::RecptprinterClient005 executing,  ret = " << ret;
        ASSERT_TRUE(ret == 0);
    }
    RECPTPRINTER_HILOGD(RECPTPRINTER_TEST, "RecptprinterClient::RecptprinterClient005 end.");
}
/**
 * @tc.name: RecptprinterClient006
 * @tc.desc: Test Recptprinter interface AddText
 * @tc.type: FUNC
 */
HWTEST_F (RecptprinterClientTest, RecptprinterClient006, TestSize.Level1)
{
    RECPTPRINTER_HILOGD(RECPTPRINTER_TEST, "RecptprinterClient::RecptprinterClient006 start.");
    auto& client = RecptprinterSrvClient::GetInstance();
    if (g_isMock) {
        int handle = -1;
        int x = -1;
        int y = -1;
        string text = ;
;
        auto ret = client.AddText(handle, x, y, text);
        RECPTPRINTER_HILOGI(RECPTPRINTER_TEST, "RecptprinterClientTest::ret=%{public}d", ret);
        GTEST_LOG_(INFO) << "RecptprinterClient::RecptprinterClient006 executing,  ret = " << ret;
        ASSERT_TRUE(ret == 0);
    } else {
        int handle = -1;
        int x = -1;
        int y = -1;
        string text = ;
;
        auto ret = client.AddText(handle, x, y, text);
        RECPTPRINTER_HILOGI(RECPTPRINTER_TEST, "RecptprinterClientTest::ret=%{public}d", ret);
        GTEST_LOG_(INFO) << "RecptprinterClient::RecptprinterClient006 executing,  ret = " << ret;
        ASSERT_TRUE(ret == 0);
    }
    RECPTPRINTER_HILOGD(RECPTPRINTER_TEST, "RecptprinterClient::RecptprinterClient006 end.");
}
/**
 * @tc.name: RecptprinterClient007
 * @tc.desc: Test Recptprinter interface AddBitmap
 * @tc.type: FUNC
 */
HWTEST_F (RecptprinterClientTest, RecptprinterClient007, TestSize.Level1)
{
    RECPTPRINTER_HILOGD(RECPTPRINTER_TEST, "RecptprinterClient::RecptprinterClient007 start.");
    auto& client = RecptprinterSrvClient::GetInstance();
    if (g_isMock) {
        int handle = -1;
        int x = -1;
        int y = -1;
        string lpath = ;
;
        auto ret = client.AddBitmap(handle, x, y, lpath);
        RECPTPRINTER_HILOGI(RECPTPRINTER_TEST, "RecptprinterClientTest::ret=%{public}d", ret);
        GTEST_LOG_(INFO) << "RecptprinterClient::RecptprinterClient007 executing,  ret = " << ret;
        ASSERT_TRUE(ret == 0);
    } else {
        int handle = -1;
        int x = -1;
        int y = -1;
        string lpath = ;
;
        auto ret = client.AddBitmap(handle, x, y, lpath);
        RECPTPRINTER_HILOGI(RECPTPRINTER_TEST, "RecptprinterClientTest::ret=%{public}d", ret);
        GTEST_LOG_(INFO) << "RecptprinterClient::RecptprinterClient007 executing,  ret = " << ret;
        ASSERT_TRUE(ret == 0);
    }
    RECPTPRINTER_HILOGD(RECPTPRINTER_TEST, "RecptprinterClient::RecptprinterClient007 end.");
}
/**
 * @tc.name: RecptprinterClient008
 * @tc.desc: Test Recptprinter interface AddQRCode
 * @tc.type: FUNC
 */
HWTEST_F (RecptprinterClientTest, RecptprinterClient008, TestSize.Level1)
{
    RECPTPRINTER_HILOGD(RECPTPRINTER_TEST, "RecptprinterClient::RecptprinterClient008 start.");
    auto& client = RecptprinterSrvClient::GetInstance();
    if (g_isMock) {
        int handle = -1;
        int x = -1;
        int y = -1;
        string qr = ;
;
        auto ret = client.AddQRCode(handle, x, y, qr);
        RECPTPRINTER_HILOGI(RECPTPRINTER_TEST, "RecptprinterClientTest::ret=%{public}d", ret);
        GTEST_LOG_(INFO) << "RecptprinterClient::RecptprinterClient008 executing,  ret = " << ret;
        ASSERT_TRUE(ret == 0);
    } else {
        int handle = -1;
        int x = -1;
        int y = -1;
        string qr = ;
;
        auto ret = client.AddQRCode(handle, x, y, qr);
        RECPTPRINTER_HILOGI(RECPTPRINTER_TEST, "RecptprinterClientTest::ret=%{public}d", ret);
        GTEST_LOG_(INFO) << "RecptprinterClient::RecptprinterClient008 executing,  ret = " << ret;
        ASSERT_TRUE(ret == 0);
    }
    RECPTPRINTER_HILOGD(RECPTPRINTER_TEST, "RecptprinterClient::RecptprinterClient008 end.");
}
/**
 * @tc.name: RecptprinterClient009
 * @tc.desc: Test Recptprinter interface AddBarCode
 * @tc.type: FUNC
 */
HWTEST_F (RecptprinterClientTest, RecptprinterClient009, TestSize.Level1)
{
    RECPTPRINTER_HILOGD(RECPTPRINTER_TEST, "RecptprinterClient::RecptprinterClient009 start.");
    auto& client = RecptprinterSrvClient::GetInstance();
    if (g_isMock) {
        int handle = -1;
        int x = -1;
        int y = -1;
        string bar = ;
;
        auto ret = client.AddBarCode(handle, x, y, bar);
        RECPTPRINTER_HILOGI(RECPTPRINTER_TEST, "RecptprinterClientTest::ret=%{public}d", ret);
        GTEST_LOG_(INFO) << "RecptprinterClient::RecptprinterClient009 executing,  ret = " << ret;
        ASSERT_TRUE(ret == 0);
    } else {
        int handle = -1;
        int x = -1;
        int y = -1;
        string bar = ;
;
        auto ret = client.AddBarCode(handle, x, y, bar);
        RECPTPRINTER_HILOGI(RECPTPRINTER_TEST, "RecptprinterClientTest::ret=%{public}d", ret);
        GTEST_LOG_(INFO) << "RecptprinterClient::RecptprinterClient009 executing,  ret = " << ret;
        ASSERT_TRUE(ret == 0);
    }
    RECPTPRINTER_HILOGD(RECPTPRINTER_TEST, "RecptprinterClient::RecptprinterClient009 end.");
}
/**
 * @tc.name: RecptprinterClient010
 * @tc.desc: Test Recptprinter interface StartPrint
 * @tc.type: FUNC
 */
HWTEST_F (RecptprinterClientTest, RecptprinterClient010, TestSize.Level1)
{
    RECPTPRINTER_HILOGD(RECPTPRINTER_TEST, "RecptprinterClient::RecptprinterClient010 start.");
    auto& client = RecptprinterSrvClient::GetInstance();
    if (g_isMock) {
        int handle = -1;
        PrintListener listener = {};
;
        auto ret = client.StartPrint(handle, listener);
        RECPTPRIN